package IMIC.NGUYENVANTINH.ARRAY.EXCERCISE.EX06;

public class Models {
	Student student = new Student();
	//Selection sort
	public Student[] SortStudent(Student[] student) {
		for (int i = student.length-1;i>=1; i--) {
			Student currentMark = student[0];
			int currentMaxIndex = 0;{
				for(int j=1;j<=i;j++){
					if(currentMark.getMark()>student[j].getMark()){
						currentMark = student[j];
						currentMaxIndex= j;
					}
				}
				if(currentMaxIndex != i){
					student[currentMaxIndex] = student[i];
					student[i] = currentMark;
				}
			}
		}

		return student;
	}
	public Student[] SortBubbleStudent(Student[] objstudent){
		for(int i=0;i< objstudent.length-1;i++){
			for(int j=0;j<objstudent.length-1-i;j++){
				if(objstudent[j].getMark()>objstudent[j+1].getMark()){
					Student temp = objstudent[j];
					objstudent[j] = objstudent[j+1];
					objstudent[j+1] = temp;
				}
			}
		}
		return objstudent;
	}

}
